/**
 * Created by Administrator on 2018/10/28.
 */
import React, {Component}from 'react'
import * as userinfoActions from '../actions/userinfo'
import {bindActionCreators} from 'redux'
class C extends React.Component {
  changeUserInfo() {
    this.props.userinfoActions.updateCityName({
      userid: 'olivia',
      city: 'beijing'
    })
  }

  render(){
    return (
        <div>
          <button onClick={this.changeUserInfo.bind(this)}>修改</button>
        </div>
    )
  }
}

function mapStateToProps(state) {
  return {
    updateCityName: state.updateCityName
  }
}

function mapDispatchToProps(dispatch) {
  return (
      userinfoActions: bindActionCreators(userinfoActions,dispatch)
  )
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(C)
